﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Warehouse.Infrastructure.Insert
{
    public interface IBaseRepository<T> where T : class
    {
        int Add(T entity);
        Task<int> AddAsync(T entity);
        int Update(T entity);
        Task<int> UpdateAsync(T entity);
        IQueryable<T> GetAll();



        int Del(T entity);
        Task<List<T>> GetAllAsync();
        Task<List<T>> GetAsync(Expression<Func<T, bool>> predicate);
        Task<T> GetModelAsync(int id);

        /// <summary>
        /// 批量真删
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Task<int> DeleteRemove(List<T> entity);

        /// <summary>
        ///批量添加
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public Task<int> AddRanges(List<T> entitys);
    }
}
